package ink.metoo.auto.fishpi

import ink.metoo.auto.fishpi.call.BaseResult
import ink.metoo.auto.fishpi.call.ChatRoomCall
import ink.metoo.auto.fishpi.call.Requests
import org.junit.Test

class ChatTest {

    @Test
    fun testMusic() {
        val msg = ""
        val json =
            "{\"coverURL\":\"https://file.fishpi.cn/2024/01/20231008142531-d6c41938.gif\",\"msgType\":\"music\",\"from\":\"\",\"source\":\"https://Google.com\",\"title\":\"${msg}\",\"type\":\"music\"}"
        println("[music]${json}[/music]")
        println(ChatRoomCall.sendMessage("[music]${json}[/music]", false).msg)
        // println(ChatRoomCall.sendMessage("[music2]${json}[music2]", false).msg)
    }

    @Test
    fun testWeather() {
        val json =
            "{\"date\":\"Rainhater,看看,你姐姐\",\"st\":\"Rainhater看看你姐姐\",\"min\":\"1.55,1.62,1.25\",\"msgType\":\"weather\",\"t\":\"Rainhater通缉令\",\"max\":\"1.45,1.91,1.68\",\"weatherCode\":\"PARTLY_CLOUDY_DAY,LIGHT_RAIN,LIGHT_RAIN\",\"type\":\"weather\"}"
        println("[weather]${json}[/weather]")
        println(ChatRoomCall.sendMessage("[weather]${json}[/weather]", false).msg)
    }

    @Test
    fun testSend() {
        val result = Requests.sendJsonRequest<BaseResult>(
            path = "/chat-room/send",
            body = mapOf(
                "apiKey" to "df4b5ab0403ca0fb543147c2ae9c463fff489ca8b3c6fe0512dfafc8ef4858af69dac29fa75d1ba23f8e249f8d8c853b13e975ea68bdd844b3204285b35c78198d5cd6c7731e3c0ccdc72e2e23c3254cb495e695e8ddfaf998988927fd8323c1",
                "content" to "我是机器人"
            )
        )
        println(result.msg)
    }

}